import http from './request'

export function get(url:string, params = {}) {
    return new Promise((resolve, reject) => {
        http
            .get(url, {
                params: params
            })
            .then(response => {
                resolve(response)
            })
            .catch(err => {
                reject(err)
            })
    })
}

export function post(url:string, data = {}, config:any={}) {
    return new Promise((resolve, reject) => {
        http.post(url, data, config).then(
            response => {
                resolve(response)
            },
            err => {
                reject(err)
            }
        )
    })
}